// index.js
const QQMapWX = require("../../libs/qqmap-wx-jssdk");
const qqmapsdk = new QQMapWX({
  key: "52GBZ-6X5C7-UZ3XK-HS5W5-YTOZT-GXBZX"
})
Page({
  data: {
    markers: [
      {
        id: 1,
        longitude: 117.268969,
        latitude: 32.915842,
        width: 30,
        height: 40,
        iconPath:'/images/学校.png',
        label: {
          content: '我们的校园'
        }
      },
      {
        id: 2,
        longitude: 117.268758,
        latitude: 32.918625,
        width: 30,
        height: 40,
        iconPath:'/images/宿舍楼-copy.png',
        label: {
          content: '15栋宿舍楼'
        }
      },
      {
        id: 3,
        longitude: 117.271589,
        latitude: 32.915615,
        width: 30,
        height: 40,
        iconPath:'/images/教学楼.png',
        label: {
          content: '诚意楼'
        }
      },
      {
        id: 4,
        longitude: 117.270415,
        latitude: 32.917368,
        width: 30,
        height: 40,
        iconPath:'/images/行政楼.png',
        label: {
          content: '图书馆'
        }
      }
    ]
  },
  onload: function(){
  },
  zoomIn: function(){
    const mapCtx =wx.createMapContext('campusMap');
    mapCtx.includePoints({
      points:[],
        duration: 300
    });
},
zoomOut: function(){
  const mapCtx =wx.createMapContext('campusMap');
  let scale =mapCtx.getScale();
  if(scale>1){
    mapCtx.scale(-1);
  }
},



  search() {
    qqmapsdk.search({
      keyword: '饭店',
      success: res => {
        console.log(res)
      },
      fail: res => {
        console.log(res)
      }
    })
  }




  

})
